//
//  BK_SPS_Member_Cell.m
//  bestkeep
//
//  Created by TOPTEAM on 2017/4/7.
//  Copyright © 2017年 utouu. All rights reserved.
//

#import "BK_SPS_Member_Cell.h"
#import <Masonry.h>
#import "BK_OD_Color.h"

@interface BK_SPS_Member_Cell ()




@property(nonatomic, strong) UIImageView *ImgV_Zhe;//折
@property(nonatomic, strong) UIButton *btn_Member;//

@property (nonatomic,strong) UILabel* lab_tip_up;//全场享受8折
@property (nonatomic,strong) UILabel* lab_tip_down;//开通本单可优惠3元






@end



@implementation BK_SPS_Member_Cell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self){
        self.backgroundColor = [UIColor whiteColor];
        [self initView];
    }
    return self;
}

- (void)initView{
    
    
    
    /*
     * 折
     */
    _ImgV_Zhe=[[UIImageView alloc]init];
    _ImgV_Zhe.backgroundColor = [UIColor whiteColor];
    _ImgV_Zhe.contentMode = UIViewContentModeScaleToFill;
    _ImgV_Zhe.image=[UIImage imageNamed:@"BK_PayStore_discount"];
    [self addSubview:_ImgV_Zhe];
    [_ImgV_Zhe mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(62/2.0);
        make.left.equalTo(self.mas_left).offset(21.0);
        make.width.mas_equalTo(@(84/2.0));
        make.height.mas_equalTo(@(87/2.0));
        
    }];
    

    
    /*
     * 全场享受8折
     */
    _lab_tip_up = [UILabel new];
    _lab_tip_up.textColor = kOrderBlack1;
    _lab_tip_up.numberOfLines = 1;
    _lab_tip_up.backgroundColor = [UIColor clearColor];
    _lab_tip_up.font = [UIFont systemFontOfSize:14];
    _lab_tip_up.text = @"全场商品88折起";
    [self addSubview:_lab_tip_up];
    [_lab_tip_up mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_ImgV_Zhe.mas_right).mas_offset(44/2.0);
        make.top.equalTo(_ImgV_Zhe.mas_top).mas_offset(0);
        make.height.mas_equalTo(20);
    }];
    
    
    
    /*
     * 开通本单可优惠3元
     */
    _lab_tip_down = [UILabel new];
    _lab_tip_down.textColor = kOrderPriceRed;
    _lab_tip_down.numberOfLines = 1;
    _lab_tip_down.backgroundColor = [UIColor clearColor];
    _lab_tip_down.font = [UIFont systemFontOfSize:12];
    _lab_tip_down.text = @"开通vip享线上线下全场折扣";
    [self addSubview:_lab_tip_down];
    [_lab_tip_down mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_lab_tip_up.mas_left).mas_offset(0);
        make.top.equalTo(_lab_tip_up.mas_bottom).mas_offset(0);
        make.height.mas_equalTo(33/2.0);
    }];

    
    _btn_Member=[[UIButton alloc]init];
    _btn_Member.backgroundColor=kOrderBKGreen;
    [_btn_Member.layer setCornerRadius:5.0]; //设置矩形圆角半径
    [_btn_Member.layer setBorderWidth:1.0]; //边框宽度
    CGColorSpaceRef colorSpace1 = CGColorSpaceCreateDeviceRGB();
    CGColorRef colorref1 = CGColorCreate(colorSpace1,(CGFloat[]){ 0.f/255.f,186.f/255.f,156.f/255.f , 1 });
    [_btn_Member.layer setBorderColor:colorref1];//边框颜色
    [_btn_Member addTarget:self action:@selector(Action_Again) forControlEvents:UIControlEventTouchUpInside];
    [_btn_Member setTitle:@"开通会员" forState:UIControlStateNormal];//button title
    [_btn_Member setTitleColor:kOrderWhite forState:UIControlStateNormal];//title color
    [self addSubview:_btn_Member];
    [_btn_Member mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.bottom.equalTo(self.mas_bottom).offset(-20.0);
        make.right.mas_equalTo(self.mas_right).offset(-20.0);
        make.width.mas_equalTo(@(ScreenWidth-2*20.0));
        make.height.mas_equalTo(@(40));
    }];


    
    
}

-(void)Action_Again{
    if ([self.delegate respondsToSelector:@selector(BK_SPS_Member_clicked)]) {
        [self.delegate BK_SPS_Member_clicked];
    }
}
+(CGFloat)computeHeight:(id)data{
    return 160;
}
-(void)relayOutUIWithModel:(BK_SP_OD_Model *)model{
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
